#include "../include/CourseSelection.h"

// 构造函数实现
CourseSelection::CourseSelection(const std::string& studentId, const std::string& courseId, 
                                 const std::string& semester, double score)
    : studentId(studentId), courseId(courseId), semester(semester), score(score) {}

// Getter方法实现
std::string CourseSelection::getStudentId() const { return studentId; }
std::string CourseSelection::getCourseId() const { return courseId; }
std::string CourseSelection::getSemester() const { return semester; }
double CourseSelection::getScore() const { return score; }

// Setter方法实现
void CourseSelection::setStudentId(const std::string& studentId) { this->studentId = studentId; }
void CourseSelection::setCourseId(const std::string& courseId) { this->courseId = courseId; }
void CourseSelection::setSemester(const std::string& semester) { this->semester = semester; }
void CourseSelection::setScore(double score) { this->score = score; }

// 输出运算符重载实现
std::ostream& operator<<(std::ostream& os, const CourseSelection& selection) {
    os << selection.studentId << '\t' << selection.courseId << '\t' 
       << selection.semester << '\t' << selection.score;
    return os;
}

// 输入运算符重载实现
std::istream& operator>>(std::istream& is, CourseSelection& selection) {
    is >> selection.studentId >> selection.courseId >> selection.semester >> selection.score;
    return is;
}

// 比较运算符实现
bool CourseSelection::operator==(const CourseSelection& other) const {
    return studentId == other.studentId && courseId == other.courseId;
}